<div class="problemindexholder" problemindex="A">
 <div class="ttypography">
  <div class="problem-statement">
   <div class="header">
    <div class="title">
     A. Leha and Function
    </div>
    <div class="time-limit">
     <div class="property-title">
      time limit per test
     </div>
     2 seconds
    </div>
    <div class="memory-limit">
     <div class="property-title">
      memory limit per test
     </div>
     256 megabytes
    </div>
    <div class="input-file">
     <div class="property-title">
      input
     </div>
     standard input
    </div>
    <div class="output-file">
     <div class="property-title">
      output
     </div>
     standard output
    </div>
   </div>
   <div>
    <p>
     Leha like all kinds of strange things. Recently he liked the function
     <span class="tex-span">
      <i>
       F
      </i>
      (
      <i>
       n
      </i>
      ,
      <i>
       k
      </i>
      )
     </span>
     . Consider all possible
     <span class="tex-span">
      <i>
       k
      </i>
     </span>
     -element subsets of the set
     <span class="tex-span">
      [1, 2, ...,
      <i>
       n
      </i>
      ]
     </span>
     . For subset find minimal element in it.
     <span class="tex-span">
      <i>
       F
      </i>
      (
      <i>
       n
      </i>
      ,
      <i>
       k
      </i>
      )
     </span>
     — mathematical expectation of the minimal element among all
     <span class="tex-span">
      <i>
       k
      </i>
     </span>
     -element subsets.
    </p>
    <p>
     But only function does not interest him. He wants to do interesting things with it. Mom brought him two arrays
     <span class="tex-span">
      <i>
       A
      </i>
     </span>
     and
     <span class="tex-span">
      <i>
       B
      </i>
     </span>
     , each consists of
     <span class="tex-span">
      <i>
       m
      </i>
     </span>
     integers. For all
     <span class="tex-span">
      <i>
       i
      </i>
      ,
      <i>
       j
      </i>
     </span>
     such that
     <span class="tex-span">
      1 ≤
      <i>
       i
      </i>
      ,
      <i>
       j
      </i>
      ≤
      <i>
       m
      </i>
     </span>
     the condition
     <span class="tex-span">
      <i>
       A
      </i>
      <sub class="lower-index">
       <i>
        i
       </i>
      </sub>
      ≥
      <i>
       B
      </i>
      <sub class="lower-index">
       <i>
        j
       </i>
      </sub>
     </span>
     holds. Help Leha rearrange the numbers in the array
     <span class="tex-span">
      <i>
       A
      </i>
     </span>
     so that the sum
     <img align="middle" class="tex-formula" src="/predownloaded/ff/30/ff3081dd4c7f8c283c679892952dcda2e79d8993.png" style="max-width: 100.0%;max-height: 100.0%;"/>
     is maximally possible, where
     <span class="tex-span">
      <i>
       A
      </i>
      '
     </span>
     is already rearranged array.
    </p>
   </div>
   <div class="input-specification">
    <div class="section-title">
     Input
    </div>
    <p>
     First line of input data contains single integer
     <span class="tex-span">
      <i>
       m
      </i>
     </span>
     (
     <span class="tex-span">
      1 ≤
      <i>
       m
      </i>
      ≤ 2·10
      <sup class="upper-index">
       5
      </sup>
     </span>
     ) — length of arrays
     <span class="tex-span">
      <i>
       A
      </i>
     </span>
     and
     <span class="tex-span">
      <i>
       B
      </i>
     </span>
     .
    </p>
    <p>
     Next line contains
     <span class="tex-span">
      <i>
       m
      </i>
     </span>
     integers
     <span class="tex-span">
      <i>
       a
      </i>
      <sub class="lower-index">
       1
      </sub>
      ,
      <i>
       a
      </i>
      <sub class="lower-index">
       2
      </sub>
      , ...,
      <i>
       a
      </i>
      <sub class="lower-index">
       <i>
        m
       </i>
      </sub>
     </span>
     (
     <span class="tex-span">
      1 ≤
      <i>
       a
      </i>
      <sub class="lower-index">
       <i>
        i
       </i>
      </sub>
      ≤ 10
      <sup class="upper-index">
       9
      </sup>
     </span>
     ) — array
     <span class="tex-span">
      <i>
       A
      </i>
     </span>
     .
    </p>
    <p>
     Next line contains
     <span class="tex-span">
      <i>
       m
      </i>
     </span>
     integers
     <span class="tex-span">
      <i>
       b
      </i>
      <sub class="lower-index">
       1
      </sub>
      ,
      <i>
       b
      </i>
      <sub class="lower-index">
       2
      </sub>
      , ...,
      <i>
       b
      </i>
      <sub class="lower-index">
       <i>
        m
       </i>
      </sub>
     </span>
     (
     <span class="tex-span">
      1 ≤
      <i>
       b
      </i>
      <sub class="lower-index">
       <i>
        i
       </i>
      </sub>
      ≤ 10
      <sup class="upper-index">
       9
      </sup>
     </span>
     ) — array
     <span class="tex-span">
      <i>
       B
      </i>
     </span>
     .
    </p>
   </div>
   <div class="output-specification">
    <div class="section-title">
     Output
    </div>
    <p>
     Output
     <span class="tex-span">
      <i>
       m
      </i>
     </span>
     integers
     <span class="tex-span">
      <i>
       a
      </i>
      '
      <sub class="lower-index">
       1
      </sub>
      ,
      <i>
       a
      </i>
      '
      <sub class="lower-index">
       2
      </sub>
      , ...,
      <i>
       a
      </i>
      '
      <sub class="lower-index">
       <i>
        m
       </i>
      </sub>
     </span>
     — array
     <span class="tex-span">
      <i>
       A
      </i>
      '
     </span>
     which is permutation of the array
     <span class="tex-span">
      <i>
       A
      </i>
     </span>
     .
    </p>
   </div>
   <div class="sample-tests">
    <div class="section-title">
     Examples
    </div>
    <div class="sample-test">
     <div class="input">
      <div class="title">
       Input
      </div>
      <pre>5<br/>7 3 5 3 4<br/>2 1 3 2 3<br/></pre>
     </div>
     <div class="output">
      <div class="title">
       Output
      </div>
      <pre>4 7 3 5 3<br/></pre>
     </div>
     <div class="input">
      <div class="title">
       Input
      </div>
      <pre>7<br/>4 6 5 8 8 2 6<br/>2 1 2 2 1 1 2<br/></pre>
     </div>
     <div class="output">
      <div class="title">
       Output
      </div>
      <pre>2 6 4 5 8 8 6<br/></pre>
     </div>
    </div>
   </div>
  </div>
  <p>
  </p>
 </div>
</div>
